package com.cssy.authority.service.impl;

import java.util.Date;
import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;

import com.byd.acegiext.domain.User;
import com.cssy.authority.dao.ScUserRolewhPlaceDAO;
import com.cssy.authority.entity.ScUserRolewhPlaceDO;
import com.cssy.authority.service.IScUserRolewhPlaceService;
import com.plat.exception.SyBaseException;
import com.plat.helper.SearchConditions;
import com.plat.helper.SearchResult;
import com.plat.util.IDCodeTypeUtil;


@Service("scUserRolePlaceService")
public class ScUserRolewhPlaceServiceImpl implements IScUserRolewhPlaceService{

	
	@Resource(name="scUserRolewhPlaceDAO")	
	private ScUserRolewhPlaceDAO scUserRolewhPlaceDAO;
	

	@Override
	public SearchResult findListByExample(SearchConditions scs)
			throws SyBaseException {
		SearchResult rs=new SearchResult(scs);
		List<ScUserRolewhPlaceDO>  list=scUserRolewhPlaceDAO.find(scs);
		rs.setRecordCount(scUserRolewhPlaceDAO.count(scs));
		rs.setResults(list);
		return rs;
	}
	
	/**
	 * 查询角色车间
	 */
	@Override
	public SearchResult findShopListByExample(SearchConditions scs)
			throws SyBaseException {
		SearchResult rs=new SearchResult(scs);
		List<ScUserRolewhPlaceDO>  list=scUserRolewhPlaceDAO.findShop(scs);
		rs.setRecordCount(scUserRolewhPlaceDAO.countShop(scs));
		rs.setResults(list);
		return rs;
	}

	@Override
	public Integer delete(String id, User user) throws SyBaseException {
		scUserRolewhPlaceDAO.deleteScUserRolewhPlaceDOByPrimaryKey(id);
		return null;
	}

	@Override
	public Integer update(ScUserRolewhPlaceDO t, User user) throws SyBaseException {
		t.setDuuser(user.getName());
		t.setDutime(new Date());
		return scUserRolewhPlaceDAO.updateScUserRolewhPlaceDO(t);
	}

	@Override
	public ScUserRolewhPlaceDO save(ScUserRolewhPlaceDO t, User user)
			throws SyBaseException {
		t.setDcrname(user.getName());
		t.setDcrtime(new Date());
		t.setId(IDCodeTypeUtil.getId());
		scUserRolewhPlaceDAO.insertScUserRolewhPlaceDO(t);
		return t;
	}

	@Override
	public ScUserRolewhPlaceDO findListById(String id) throws SyBaseException {
		return scUserRolewhPlaceDAO.findScUserRolewhPlaceDOByPrimaryKey(id);
	}

	@Override
	public Integer deleteBizRemoved(String id) throws SyBaseException {
		// TODO Auto-generated method stub
		return null;
	}

}
